package com.tencent.stat;

import android.content.Context;
import com.tencent.stat.common.StatCommonHelper;
import com.tencent.stat.common.StatLogger;
import java.util.Timer;
import java.util.TimerTask;

public class c
{
  private static volatile c b = null;
  private Timer a = null;
  private Context c = null;

  private c(Context paramContext)
  {
    this.c = paramContext.getApplicationContext();
    this.a = new Timer(false);
  }

  public static c a(Context paramContext)
  {
    if (b == null)
      monitorenter;
    try
    {
      if (b == null)
        b = new c(paramContext);
      return b;
    }
    finally
    {
      monitorexit;
    }
  }

  public void a()
  {
    if (StatConfig.getStatSendStrategy() != StatReportStrategy.PERIOD)
      return;
    long l = StatConfig.getSendPeriodMinutes() * 60 * 1000;
    if (StatConfig.isDebugEnable())
      StatCommonHelper.getLogger().i("setupPeriodTimer delay:" + l);
    a(new d(this), l);
  }

  public void a(TimerTask paramTimerTask, long paramLong)
  {
    if (this.a != null)
    {
      if (StatConfig.isDebugEnable())
        StatCommonHelper.getLogger().i("setupPeriodTimer schedule delay:" + paramLong);
      this.a.schedule(paramTimerTask, paramLong);
    }
    do
      return;
    while (!(StatConfig.isDebugEnable()));
    StatCommonHelper.getLogger().w("setupPeriodTimer schedule timer == null");
  }
}